package com.example.demo.controller;

import com.example.demo.utils.CommonUtil;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/fans")
public class FansController {


    /*
     *
     * 2、通过HttpServletRequest接收   http://localhost:8090/fans/get_fan?fan=fan1
     *跳转到指定项目
     */
    @RequestMapping("/get_fan")
    public ModelAndView test_FanResult(HttpServletRequest request, Model model) {
        String fan = request.getParameter("fan");

        return new ModelAndView("error", "dataModel", model);
    }

    //  http://localhost:8090/fans/blog
    @GetMapping("/blog")
    public ModelAndView myBlog(Model model) {
        System.err.println("blog====>>");

        CommonUtil.getCommonModel(model);

        return new ModelAndView("blog_zone/index.html", "dataModel", model);
    }


    //  http://localhost:8090/fans/image_list
    @GetMapping("/image_list")
    public ModelAndView myImage(Model model) {
        System.err.println("image====>>");

        CommonUtil.getCommonModel(model);

        return new ModelAndView("blog_zone/image_list.html", "dataModel", model);
    }
    //  http://localhost:8090/fans/app_list
    @GetMapping("/app_list")
    public ModelAndView myApps(Model model) {
        System.err.println("app_list====>>");

        CommonUtil.getCommonModel(model);
        return new ModelAndView("blog_zone/app_list02.html", "dataModel", model);
    }

}


